<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<body >
<!-- datagrid知识 -->
<script type="text/javascript">
$(function(){
	$("#admin_productBrand_datagrid").datagrid({
		url : 'product/productBrands',
		iconCls : 'icon_save',
		pagination : true, //是否有分页
		pageSize : 15,
		pageList : [ 15, 30, 45, 60, 75, 90],
		fit : true, //窗口自适应.
		border : false, //去掉边框
		fitColumns : true, //是否底部设置滚动条(列少建议为true列多建议为false)
		nowrap : true, //是否自动换行
		idField : 'code',//标识
		//loadMsg: '数据装载中......',
		columns : [ [{
			title : '编号',
			field : 'code',
			width : 100,
			hidden : true
		},{
			title : '品牌名称',
			field : 'name',
			width : 100
		},{
			title : '是否可见',
			field : 'visible',
			width : 100,
			formatter:function(value,row,index){
				if (value==true) {
					return "可见";
				}else{
					return "不可见";
				}
			}
		},{
			title : '品牌LOGO',
			field : 'logopath',
			width : 50,
			formatter: function(value, row, index) {
				 return '<img src="<%=request.getContextPath() %>/' + value + '" />';
            }
		}, {
			field : 'action',
			title : '操作',
			width : 100,
			formatter : function(value, row, index) {
				var str = '';
				if ($.canEdit) {
					str += $.formatString('<img onclick="editFun(\'{0}\');" src="{1}" title="编辑"/>', row.id, '${pageContext.request.contextPath}/style/images/extjs_icons/pencil.png');
				}
				str += '&nbsp;';
				if ($.canGrant) {
					str += $.formatString('<img onclick="grantFun(\'{0}\');" src="{1}" title="授权"/>', row.id, '${pageContext.request.contextPath}/style/images/extjs_icons/key.png');
				}
				str += '&nbsp;';
				if ($.canDelete) {
					str += $.formatString('<img onclick="deleteFun(\'{0}\');" src="{1}" title="删除"/>', row.id, '${pageContext.request.contextPath}/style/images/extjs_icons/cancel.png');
				}
				str += '&nbsp;';
				if ($.canEditPwd) {
					str += $.formatString('<img onclick="editPwdFun(\'{0}\');" src="{1}" title="修改密码"/>', row.id, '${pageContext.request.contextPath}/style/images/extjs_icons/lock/lock_edit.png');
				}
				return str;
			}
		}] ]
	});
});  
</script>
		<table id="admin_productBrand_datagrid" ></table>
</body> 
